/*************** 内容消息验证  *********************/
$(function() {
	$("#image_text_ym").hide();
	$("#changRoleDiv").hide();
	$("#image_text_ym input[type='radio']").attr("type","");
	$("#character").click(function() {
		$("#image_text_ym input[type='radio']").attr("type","");
		$("#character_ym input[type='']").attr("type","radio");
		$("#image_text_ym").hide();
		$("#changRoleDiv").hide();
		$("#image_text").removeClass("active");
		$("#change_role").removeClass("active");
		$("#character_ym").show();
		$("#character").addClass("active");
	});
	$("#image_text").click(function() {
		$("#character_ym input[type='radio']").attr("type","");
		$("#image_text_ym input[type='']").attr("type","radio");
		$("#character_ym").hide();
		$("#changRoleDiv").hide();
		$("#character").removeClass("active");
		$("#change_role").removeClass("active");
		$("#image_text_ym").show();
		$("#image_text").addClass("active");
	});
	$("#change_role").click(function() {
		$("#character_ym").hide();
		$("#image_text_ym").hide();
		$("#changRoleDiv").show();
		$("#character").removeClass("active");
		$("#image_text").removeClass("active");
		$("#change_role").addClass("active");
	});
	
	
	$("#character_form").validate({
		rules: {
			msgContent: {
				required: true
			}
		},
		messages: {
			msgContent: {
				required: "内容不能为空",
			}
		}
	});
/*	$("#submit").click(function() {
		if($("#optionsRadios").is(":checked")) {} else {
			alert('发送模式必须选择一种');
		}
	});*/
	
	
	$("#image_text_form").validate({
		rules: {
			inputfile: {
				checkPic: true
			},
			title: {
				required: true
			},
			msgContent: {
				required: true
			}
		},
		messages: {
			title: {
				required: "标题不能为空",
			},
			msgContent: {
				required: "内容不能为空",
			}
		}
	});
	/*$("#submit").click(function() {
		if($("#optionsRadios").is(":checked")) {} else {
			alert('发送模式必须选择一种');}
	});*/
	
	
	
	//提交
	/*$("#character_submit").click(function() {
		if(!$("#character_form").valid())
			return;
		var formData = {};
		$.each($("#character_form").serializeArray(), function(i, item) {
			formData[item.name] = item.value;
		});
		$.ajax({
			type: 'POST',
			url: '${ctx}/cloudling/submit',
			data: formData,
			dataType: 'json',
			cache: false,
			success: function(data) {
				$("#submit").attr("disabled", "disabled");
				$("#submit").tips({
					side: 2,
					msg: data.message,
					bg: '#AE81FF',
					time: 3
				});
				 window.location.href = "${ctx}/pages/insurance/succeed.jsp" 
				return;
			},
			error: function(result) {
				console.info("表单提交错误：" + result);
			}
		});
	});*/

});
